# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: MCMic <come.bernigaud@laposte.net>

pkgname=tetrinet
pkgver=0.11
pkgrel=9
pkgdesc="Multiplayer online Tetris game for up to six people"
url="http://tetrinet.or.cz/"
arch=('loong64' 'x86_64')
license=('Public domain')
depends=('ncurses')
makedepends=('pkgconfig')
source=(${pkgname}-${pkgver}.tar.bz2::http://tetrinet.or.cz/download/${pkgname}-${pkgver}.tar.bz2
        tetrinet-build.patch)
sha512sums=('8123a8c50a3c1b6326d3209272a60c8050afd2a9eb455814fd676d8c4de922f8b81a88df9e4825d1ff5e0c8b8a7ac46ebe9ce68994587f829e047a3d889880fa'
            '617f41f7c64b718f036c17262faf43eb47395fcbf3163560105257257e6acc73c1306527a4293154ad520cb800da84f626f8156b3cb09381e362e566545366b0')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p1 < "${srcdir}/tetrinet-build.patch"
}

build() {
  cd ${pkgname}-${pkgver}
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  make
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 755 tetrinet "${pkgdir}/usr/bin/tetrinet"
  install -Dm 755 tetrinet-server "${pkgdir}/usr/bin/tetrinet-server"
  install -Dm 644 README "${pkgdir}/usr/share/doc/${pkgname}/README"
  install -Dm 644 tetrinet.txt "${pkgdir}/usr/share/doc/${pkgname}/tetrinet.txt"
}

# vim: ts=2 sw=2 et:
